# from celery import Celery
#
# import os
# if not os.getenv('DJANGO_SETTINGS_MODULE'):
#     os.environ['DJANGO_SETTINGS_MODULE'] = 'pro_mysite.settings'
#
# # 创建celery实例
# app = Celery('to_sms')
#
# # 导入celery配置
# app.config_from_object('celery_tasks.config')
#
# # 自定义注册任务
# app.autodiscover_tasks(['celery_tasks.sms'])
#
#

from celery import Celery

# 为celery使用django配置文件进行设置
import os
if not os.getenv('DJANGO_SETTINGS_MODULE'):
    os.environ['DJANGO_SETTINGS_MODULE'] = 'pro_mysite.settings'

# 创建celery应用/实例
app = Celery('codes')

# 导入celery配置
app.config_from_object('celery_tasks.config')

# 自动注册celery任务
app.autodiscover_tasks(['celery_tasks.sms'])



